package cl;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;

import cl.lexer.Lexer;
import cl.lexer.LexerException;
import cl.lexer.Token;
import cl.parser.ParseException;
import cl.parser.Parser;
import cl.parser.internal.InternalNode;
import cl.util.FileUtil;

public class Main {
    
    public static void main(String[] args) {
        List<Token> tokens;
        InternalNode root = null;
        
        try {
            tokens = new Lexer().parse(FileUtil.read(new File("test.txt")));
            root = (InternalNode) new Parser().parse(tokens);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (LexerException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        

        System.out.println(root.treePrint());
        System.out.println(root.prettyPrint(""));
    }

}
